Machine Learning for Source Code (ML4Code) is an active research field in which extensive experimentation is needed to discover how to best use source code's richly structured information. With this in mind, we introduce JEMMA, an Extensible Java Dataset for ML4Code Applications, which is a large-scale, diverse, and high-quality dataset targeted at ML4Code. Our goal with JEMMA is to lower the barrier to entry in ML4Code by providing the building blocks to experiment with source code models and tasks. JEMMA comes with a considerable amount of pre-processed information such as metadata, representations (e.g., code tokens, ASTs, graphs), and several properties (e.g., metrics, static analysis results) for 50,000 Java projects from the 50KC dataset, with over 1.2 million classes and over 8 million methods. JEMMA is also extensible allowing users to add new properties and representations to the dataset, and evaluate tasks on them. Thus, JEMMA becomes a workbench that researchers can use to experiment with novel representations and tasks operating on source code. To demonstrate the utility of the dataset, we also report results from two empirical studies on our data, ultimately showing that significant work lies ahead in the design of context-aware source code models that can reason over a broader network of source code entities in a software project, the very task that JEMMA is designed to help with.
translated by 谷歌翻译
集成开发环境(IDE)提供工具支持,以自动化许多源代码编辑任务。传统上,IDE仅使用空间上下文,即开发人员正在编辑的位置来生成候选编辑建议。但是,仅空间上下文通常不足以自信地预测开发人员的下一个编辑,因此IDE在某个位置会产生许多建议。因此,IDE通常不会主动提供建议,而是需要单击特定图标或菜单,然后从大量潜在建议列表中进行选择。结果,开发人员通常会错过使用工具支持的机会,因为他们不知道它存在或忘记使用它。为了更好地理解开发人员行为中的常见模式并产生更好的编辑建议,我们还可以使用时间上下文,即开发人员最近执行的编辑。为了启用基于时间上下文的编辑建议,我们提出了《守望先锋》,这是一种从IDE中执行的开发人员编辑痕迹学习编辑序列模式的新颖技术。我们的实验表明,《守望先锋》具有78%的精度,守望先锋不仅完成了开发人员错过使用IDE工具支持的机会,而且还预测了在IDE中没有工具支持的新编辑。
translated by 谷歌翻译
In software development, it is common for programmers to copy-paste or port code snippets and then adapt them to their use case. This scenario motivates the code adaptation task -- a variant of program repair which aims to adapt variable identifiers in a pasted snippet of code to the surrounding, preexisting source code. However, no existing approach has been shown to effectively address this task. In this paper, we introduce AdaptivePaste, a learning-based approach to source code adaptation, based on transformers and a dedicated dataflow-aware deobfuscation pre-training task to learn meaningful representations of variable usage patterns. We evaluate AdaptivePaste on a dataset of code snippets in Python. Results suggest that our model can learn to adapt source code with 79.8% accuracy. To evaluate how valuable is AdaptivePaste in practice, we perform a user study with 10 Python developers on a hundred real-world copy-paste instances. The results show that AdaptivePaste reduces the dwell time to nearly half the time it takes for manual code adaptation, and helps to avoid bugs. In addition, we utilize the participant feedback to identify potential avenues for improvement of AdaptivePaste.
translated by 谷歌翻译
Semantic code search is the task of retrieving a code snippet given a textual description of its functionality. Recent work has been focused on using similarity metrics between neural embeddings of text and code. However, current language models are known to struggle with longer, compositional text, and multi-step reasoning. To overcome this limitation, we propose supplementing the query sentence with a layout of its semantic structure. The semantic layout is used to break down the final reasoning decision into a series of lower-level decisions. We use a Neural Module Network architecture to implement this idea. We compare our model - NS3 (Neuro-Symbolic Semantic Search) - to a number of baselines, including state-of-the-art semantic code retrieval methods, and evaluate on two datasets - CodeSearchNet and Code Search and Question Answering. We demonstrate that our approach results in more precise code retrieval, and we study the effectiveness of our modular design when handling compositional queries.
translated by 谷歌翻译
因果推断对于跨业务参与,医疗和政策制定等领域的数据驱动决策至关重要。然而,关于因果发现的研究已经与推理方法分开发展,从而阻止了两个领域方法的直接组合。在这项工作中,我们开发了深层端到端因果推理(DECI),这是一种基于流动的非线性添加噪声模型,该模型具有观察数据,并且可以执行因果发现和推理,包括有条件的平均治疗效果(CATE) )估计。我们提供了理论上的保证,即DECI可以根据标准因果发现假设恢复地面真实因果图。受应用影响的激励,我们将该模型扩展到具有缺失值的异质,混合型数据,从而允许连续和离散的治疗决策。我们的结果表明,与因果发现的相关基线相比,DECI的竞争性能和(c)在合成数据集和因果机器学习基准测试基准的一千多个实验中,跨数据类型和缺失水平进行了估计。
translated by 谷歌翻译
从结构化数据中学习是一项核心机器学习任务。通常,此类数据表示为图,通常仅考虑(键入)节点对之间的二进制关系。对于具有高度结构化数据的许多域而言,这是一个实质性的限制。一个重要的域是源代码,基于超图的表示可以更好地捕获代码的语义丰富和结构化的性质。在这项工作中,我们提出了热量,这是一种能够代表键入和合格的超图的神经模型,在该模型中,每个Hyperede都明确地符合参与节点的贡献。它可以看作是传递神经网络和变压器的消息的概括。我们使用新型程序代表程序来评估知识库完成和错误检测和维修的热量。在这两种情况下,它都优于强大的基线,表明其力量和通用性。
translated by 谷歌翻译
基于机器学习的程序分析最近显示了整合正式和概率推理对辅助软件开发的承诺。但是,在没有大型注释的语料库的情况下,培训这些分析是挑战性的。为了解决这个问题,我们呈现Buglab,一种自我监督学习的错误检测和修复方法。Buglab Co-Trains两种型号:(1)检测仪模型,用于检测和修复代码中的错误,(2)选择器模型,了解为探测器创建用于训练数据的错误代码。在2374个真实错误的测试数据集上,Buglab的Python实现在基线方法上提高了30%,并在开源软件中找到19个以前未知的错误。
translated by 谷歌翻译
了解表格数据的语义含义需要实体链接(EL),以便将每个单元格值与知识库(KB)中的现实世界实体相关联。在这项工作中,我们将重点放在EL的端到端解决方案上,这些解决方案不依赖于目标KB中的事实查找。表格数据包含异质和稀疏上下文,包括列标题,单元格值和表格字幕。我们尝试各种模型,以生成要链接的每个单元格值的向量表示。我们的结果表明,应用注意机制和注意力面罩至关重要,这样模型只能关注最相关的环境并避免信息稀释。最相关的上下文包括:相同的单元格,相同的细胞,标题和标题。然而,计算复杂性随着这种复杂模型的表格数据的大小而倍增。我们通过引入链接Lite模型(Tell)的表格实体来实现恒定的内存使用情况,该模型仅基于其值,表格标题和表格字幕,为单元格生成向量表示。告诉Wikipedia表上的精度达到80.8%,比具有二次内存使用情况的最新模型低0.1%。
translated by 谷歌翻译
Modelling interactions is critical in learning complex dynamical systems, namely systems of interacting objects with highly non-linear and time-dependent behaviour. A large class of such systems can be formalized as $\textit{geometric graphs}$, $\textit{i.e.}$, graphs with nodes positioned in the Euclidean space given an $\textit{arbitrarily}$ chosen global coordinate system, for instance vehicles in a traffic scene. Notwithstanding the arbitrary global coordinate system, the governing dynamics of the respective dynamical systems are invariant to rotations and translations, also known as $\textit{Galilean invariance}$. As ignoring these invariances leads to worse generalization, in this work we propose local coordinate frames per node-object to induce roto-translation invariance to the geometric graph of the interacting dynamical system. Further, the local coordinate frames allow for a natural definition of anisotropic filtering in graph neural networks. Experiments in traffic scenes, 3D motion capture, and colliding particles demonstrate that the proposed approach comfortably outperforms the recent state-of-the-art.
translated by 谷歌翻译